package com.jiutong.meipengdai.http.model.requests;

import com.jiutong.meipengdai.base.CommonAdapter;
import com.jiutong.meipengdai.http.RetrofitHandle;
import com.jiutong.meipengdai.http.SubscribeHandler;
import com.jiutong.meipengdai.http.model.services.ArticleService;
import com.jiutong.meipengdai.http.model.services.CommentService;

import java.util.Map;

import rx.Observable;
import rx.Subscriber;

/**
 * 作用:
 * Created by 78 on 2017/7/6.
 */

public class CommonRequest extends SubscribeHandler {

    /**
     * 市区列表
     */
    public void getAreaDate(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "house.city.area.open");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getAreaDate(fields);

        toSubscribe(observable, subscriber);
    }


    /**
     * 评估结果
     */
    public void getEvaluateResult(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "evalue.onlineAssessInfo");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getEvaluateResult(fields);

        toSubscribe(observable, subscriber);
    }

    /**
     * 还款计划
     */
    public void getRepayPlan(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "acct.repayRecord");
        fields.put("v", "2.0");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getRepayPlan(fields);

        toSubscribe(observable, subscriber);
    }

    /**
     * 房产详情
     */
    public void getHouseDetial(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "user.house");
        fields.put("v", "2.0");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getHouseDetial(fields);

        toSubscribe(observable, subscriber);
    }

    /**
     * 银行卡校验
     */
    public void checkBankCard(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "pay.cardBin");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .checkBankCard(fields);

        toSubscribe(observable, subscriber);
    }
    /**
     * 银行卡绑定
     */
    public void bankCardBinding(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "pay.authPay");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .bankCardBinding(fields);

        toSubscribe(observable, subscriber);
    }

    public void getCityData(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "house.city.open");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getCityData(fields);

        toSubscribe(observable, subscriber);
    }

    public void getAreaAndStreedList(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "pc.price.map");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getCityData(fields);

        toSubscribe(observable, subscriber);
    }

    public void getPatch(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "app.getPatch");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .getPatch(fields);

        toSubscribe(observable, subscriber);
    }

    public void pushCrash(Subscriber subscriber, Map<String, Object> fields) {

        fields.put("method", "app.pushCrash");
        handleFields(fields);
        Observable observable = RetrofitHandle.getInstance().retrofit.create(CommentService.class)
                .pushCrash(fields);

        toSubscribe(observable, subscriber);
    }


}
